import { User, UserProfile } from '@/types/data'
import { profileGetProfile, profileGetuser } from '@/api/profile'
import { RootThunkAction } from '@/types/store'
// import request from '@/utils/request'

export function getProfile (): RootThunkAction {
  return async (dispatch) => {
    const res:{data:User} = await profileGetProfile()
    // console.log(res.data)
    dispatch({
      type: 'profile/Profile',
      payload: res.data
    })
  }
}
export function getProfileUser (): RootThunkAction {
  return async (dispatch) => {
    const res:{data:UserProfile} = await profileGetuser()
    // console.log(res.data)
    dispatch({
      type: 'profile/User',
      payload: res.data
    })
  }
}
